<?php
##############################################
#
#   商品管理
# @ Time : 2017-1-3 - 下午10:45:24
# @ Author : JiangYongWei <1085562810@qq.com>
# @ Encoding : UTF-8 language : PHP
#
##############################################

namespace Admin\Controller;
use Admin\Model\AdminBaseModel;


class PartuserController extends AdminBaseController
{
	/**
	 * 参与抽奖用户列表
	 */
	public function partUserList()
    {
        $where = I('get.');
        //var_dump($where);
        $data = D('part_user') -> getUser($where);
        //var_dump($data[0]);
        $this -> assign('user', $data[0]);
        $this -> assign('page', $data[1]);
        $this -> display('index');
	}
	
	/**
	 * 添加作品
	 */
	/*public function productAdd()
    {
        $model = D('Production');
        if (IS_POST)
        {
            if ($model->create(I('post.'), 1))
            {
                if ($model->add())
                {
                    $this->success('添加成功', U('productList'), 2);
                    exit;
                }
            }
            $this->error($model->getError());
        }
        $this -> display(add);
	}*/

    /**
     *修改作品
     * @Date 201703
     * @Author Linsenquan
     */
    /*public function productEdit()
    {
        $id=I('pro_id');
        $model = D('Production');
        if (IS_POST)
        {
            if ($data = $model->create(I('post.'),2))
            {
                //var_dump($data);die;
                if (FALSE !== $model->save())
                {
                    $this->success('修改成功','productList',1);
                    exit;
                }
            }
            $this->error($model->getError());
        }
        $product_data = M('Production') ->where(array('product_id'=>$id)) ->find();
        $this -> assign('pro', $product_data);
        $this -> display('edit');
    }*/

    /**
     * 删除
     */
    public function partUserDel()
    {
        if(!IS_AJAX) return;
        $result = D('part_user')-> deleteProduct(intval($_GET['part_id']));
        if($result)
            $this -> ajaxReturn(array('status' => 1,'message' => '删除成功'));
        else
            $this -> ajaxReturn(array('status' => 2,'message' => '操作失败'));
    }

    /**
     * 全选删除
     */
    public function deleteAllPartUser()
    {
        if(!IS_POST)
            $this->error('非法操作');
        //var_dump($_POST);die;
        $result = D('part_user')->deleteAllPartUser($_POST);
        if($result)
            $this->success('删除成功',U('partUserList'),2);
        else
            $this->error('删除失败','',2);
    }
	
}



	
	